package com.yangdage.consumer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * WarningConsumer
 *
 * @author 帅气的杨大哥
 * @version 1.0
 * @date 2021/8/6 21:53
 */
@Component
public class WarningConsumer {
    Logger log = LoggerFactory.getLogger(WarningConsumer.class);
    public static final String WARNING_QUEUE_NAME = "warning.queue";

    @RabbitListener(queues = WARNING_QUEUE_NAME)
    public void receiveWarningMsg(Message message) {
        String msg = new String(message.getBody());
        log.error("报警发现不可路由消息： {}", msg);
    }
}
